#ifndef  __COMMON_H_
#define  __COMMON_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdint.h>

#define S_RET   0
#define E_RET   -1

#define NAME_LEN	2048
#define BUFF_LEN	(1024*1025*5)
#define TERM_LEN	128
#define TERM_NODE_NUM	(1024*1024)

#define KEY_LEN		2048

#if defined(__DATE__) && defined(__TIME__)
static const char BuildDate[] = __DATE__ " " __TIME__;
#else
static const char BuildDate[] = "unknown";
#endif

inline int MySplitStringByToken(char* pString, const char* token, char* pElements[], int n)
{
  char *p1;
  int nLen = strlen(token);
  int i = 1;

  for (p1=pString, pElements[0]=pString, n--; *p1; ) {
    if (strncmp(p1, token, nLen) == 0) {
      *p1 = 0;
      p1 += nLen;

      if (i < n)
	pElements[i++] = p1;
    }
    else {
      p1 ++;
    }
  }
  return i;
}



#endif  //__COMMON_H_
